home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_09
/
9n09088a
< prev
next >
Wrap
Text File
|
1991-07-08
|
1KB
|
47 lines
/*****************************************************
* Listing 6 signon.c
*
* sign_on() -- function to automatically sign on to
* a mainframe application
*
*****************************************************/
int sign_on(void) {
int err;
if ((err = keys_to_host("MYAPP")) ! = 0)
return(err);
if ((err = input_to_host("@E")) != 0)
return(err);
if ((err = host_wait()) != 0)
return(err);
/* search PS repeatedly until finding a string
* that indicates success or failure
*/
while (1) {
err = find_msg("ENTER PASSWORD");
if (err == -1)
break; /* application available */
else if (err == > 0)
return(err);
err = find_msg("NOT AVAILABLE");
if (err == -1)
return(err); /* not available */
else if (err == > 0)
return(err);
}
/* enter 2 tabs and password */
if ((err = keys_to_host("@T@TROSEBUD")) ! = 0)
return(err);
if ((err = input_to_host("@E")) != 0)
return(err);
return(0);
}